{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form onsubmit="return false;">
                        <div class="layui-form" wid100 lay-filter="">
                            
                                <div class="layui-form-item">
                                    <label class="layui-form-label">选择优惠劵</label>
                                    <div class="layui-input-inline cate1">
                                        <select name="give_id" lay-verify="" lay-filter="choose">
                                            <option  value="">请选择</option>
                                            {volist name="coupon" id="voo"}
                                                <option value="{$voo.id}">{$voo.title}-满{$voo.man_price}减{$voo.price}元</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div> 
                                 
                            <div class="layui-form-item">
                                <label class="layui-form-label">赠送数量</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="num" lay-verify="required" placeholder="请输入赠送数量" class="layui-input">
                                </div>
                            </div>
                            <input type="hidden" name="user_id" value="{$user_id}">
                            
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" onclick="return check()">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
</body>
</html>
<script type="text/javascript">
    layui.use(['layer','form','upload'], function(){
        var $ = layui.$;
        var upload = layui.upload;
        var element = layui.element;
        
        
    });

    function check(){
        var url="{:url('/admin/user_give_add')}";
        var $ = layui.$;
        var load=layer.load(2);
        $.post(url,$("form").serialize(),function(data){
            if(data.status==1){
                layer.msg(data.msg,{icon:1,time:1000},function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    parent.location.reload();
                });
            }else{
                layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
                    layer.close(load);
                });
            }
        })
    }
</script>
